<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="string" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<%@ taglib uri="/WEB-INF/tlds/pagination.tld" prefix="pagination" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Dayve Mobile Notice Board</title>
    <link href="/common/css/common.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="/common/js/common.js"></script>
    <script type='text/javascript' src="/common/dwr/engine.js"></script>
    <script type='text/javascript' src="/common/dwr/util.js"></script>
    <script type="text/javascript">
        // 페이지 이동을 처리한다.
        function goListPage(page) {
            var TheForm = document.frm;
            TheForm.currentPage.value = page;
            TheForm.nextTarget.value = 'mNoticeBoardList';
            TheForm.action = './mNoticeBoardList.do';
            TheForm.submit();
        }

        // 검색어로 리스트를 출력한다.
        function jsSearchList() {
            var TheForm = document.frm;
            TheForm.title.value = TheForm.search_title.value;
            TheForm.writer_id.value = TheForm.search_writer.value;
            TheForm.writer_nick_name.value = TheForm.search_nickName.value;
            TheForm.content.value = TheForm.search_content.value;
            TheForm.nextTarget.value = 'mNoticeBoardList';
            TheForm.action = './mNoticeBoardList.do';
            TheForm.submit();
        }

        // 글쓰기 페이지로 이동 : 세션이 존재할 때만 가능
        function jsWriteBoard() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'noticeBoardWrite';
            TheForm.action = './noticeBoardWrite.do';
            TheForm.submit();
        }

        // 글수정 페이지로 이동 password 검사 : TheForm 에 Update Page 에 나올 내용을 담아 nextTarget 으로 넘겨준다
        function jsUpdateBoard() {
            var TheForm = document.writeFrm;
            TheForm.nextTarget.value = 'noticeBoardUpdate';
            TheForm.action = './noticeBoardUpdate.do';
            TheForm.submit();
        }

        // 글보기 페이지로 이동
        function jsContentView() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = 'noticeBoardContent';
            TheForm.action = './noticeBoardContent.do';
            TheForm.submit();
        }

        // Community Board List 페이지로 이동한다.
        function jsCommunityBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "communityBoardList";	// page name
            TheForm.action = "./communityBoardList.do";
            TheForm.submit();
        }

        // Photo Board List 페이지로 이동한다.
        function jsPhotoBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "photoBoardList";	// page name
            TheForm.action = "./photoBoardList.do";
            TheForm.submit();
        }

        // Notice Board List 페이지로 이동한다.
        function jsNoticeBoardList() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = "mNoticeBoardList";	// page name
            TheForm.action = "./mNoticeBoardList.do";
            TheForm.submit();
        }

        // Contact Us 페이지로 이동한다.
        function jsContactUs() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "contactus";	// page name
            TheForm.action = "./contactus.do";
            TheForm.submit();
        }

        // FAQ 페이지로 이동한다.
        function jsFAQ() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "faq";	// page name
            TheForm.action = "./faq.do";
            TheForm.submit();
        }

        function jsCommentEditShow(flag){
            var ct_none = "ct_none" + flag;
            var ct_show = "ct_show" + flag;
            document.getElementById(ct_none).style.display = "inline";
            document.getElementById(ct_show).style.display = "none";

        }

        function jsCommentEditClose(flag){
            var ct_none = "ct_none" + flag;
            var ct_show = "ct_show" + flag;
            document.getElementById(ct_none).style.display = "none";
            document.getElementById(ct_show).style.display = "inline";
        }

        // Board List 출력
        function jsBoardList() {
            var TheForm = document.writeFrm;
            TheForm.nextTarget.value = "mNoticeBoardList";	// page name
            TheForm.action = "./mNoticeBoardList.do";
            TheForm.submit();
        }


    </script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center" style="background-color: #FFFFFF;width: 100%">

    <div align="center" class="mainFrame" style="background-color: #FFFFFF;width: 95%;font-size: 11px;">
        <!-- 중간 메인 프레임 내용들 -->
        <p style="font: bold 30pt;padding: 20px" align="center"><img src="/images/top/notice_title.png" border="0"></p>

        <!-- notice Board View Form -->
        <form name="writeFrm" method="POST">
            <input type="hidden" name="notice_board_no" value="${board.notice_board_no}">
            <input type="hidden" name="title" value="">
            <input type="hidden" name="writer_id" value="${board.writer_id}">
            <input type="hidden" name="writer_nick_name" value="">
            <input type="hidden" name="add_file_yn" value="N">
            <input type="hidden" name="date" value="">
            <input type="hidden" name="content" value="">
            <input type="hidden" name="register_date" value="${board.register_date}">
            <input type="hidden" name="nextTarget" value="">
            <input type="hidden" name="currentPage" value="${currentPage}">
            <table border="0" style="border-top:2px solid #99ff99; border-bottom:2px solid #99ff99; border-left:2px solid #99ff99; border-right:2px solid #99ff99; background-color: white;width: 90%;font-size: 12px;">
                <tr>
                    <!-- 제목 작성 -->
                    <td class="content_title" style="border-bottom:2px dotted #99ff99" colspan="6">
                        <c:out value="${board.title}"/>
                    </td>
                </tr>
                <tr>
                    <td class="content_writer" style="border-bottom:2px dotted #99ff99" colspan="6">
                        <spring:message code="mNoticeBoardContent.dayveAdmin" />
                        <br><font color="gray" style="font-size: 5pt">${board.register_date}</font>
                    </td>
                </tr>
                <tr>
                    <!-- 본문 작성 -->
                    <td class="content_content" style="border-bottom:2px dotted #99ff99" colspan="6">
                        <div name="noticeBoardContent" style="padding: 50px">
                            <p>${board.content}</p>
                            <br/><br/>
                        </div>
                    </td>
                </tr>
                <tr>
                    <!-- 하단 기능 버튼 -->
                    <td class="content_list" colspan="2">
                        <a href="/mNoticeBoardList.do"><spring:message code="mNoticeBoardContent.list" /></a>
                    </td>
                    <td class="content_edit" colspan="4" align="right">

                    </td>
                </tr>
            </table>
        </form>
        <br/>

        <!-- Notice Board List -->
        <form name="frm" method="POST">
            <input type="hidden" name="notice_board_no" value="">
            <input type="hidden" name="title" value="">
            <input type="hidden" name="writer_id" value="">
            <input type="hidden" name="writer_nick_name" value="">
            <input type="hidden" name="content" value="">
            <input type="hidden" name="nextTarget" value="">
            <input type="hidden" name="currentPage" value="${currentPage}">
            <table border="0"  style="align: center;border-top:2px solid #99ff99; border-bottom:2px solid #99ff99; border-left:2px solid #99ff99; border-right:2px solid #99ff99; background-color: white;width: 90%">
                <c:set var="totalCount" value="${totalRow}"/>
                <c:forEach items="${boardList}" var="boardList" varStatus="serviceStatus" begin="0" end="20"
                           step="1">
                    <tr onmouseover="this.style.background='#99ff99'" onmouseout="this.style.background=''">
                        <!-- 글번호 -->
                        <td class="board_num" style="border-bottom:2px dotted #99ff99">${boardList.notice_board_no}</td>
                        <!-- Title 클릭시 GET 형식으로 게시물 번호와 현재 페이지를 noticeBoardContent 에 넘김 -->
                        <td class="board_title" style="border-bottom:2px dotted #99ff99">
                            <a href="./mNoticeBoardContent.do?boardno=${boardList.notice_board_no}&page=${currentPage}&title&writer_id&writer_nick_name&content">
                                    ${boardList.title}
                                <br><font color="gray" style="font-size: 5pt">${boardList.register_date}</font>
                            </a>
                        </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td height="30" align="center" colspan="6">
                        <div align="center">
                            <pagination:paging>
                                <pagination:function>goListPage</pagination:function> <!-- 자바스크립트 함수 -->
                                <pagination:currentPage>${currentPage}</pagination:currentPage> <!-- 현재페이지 -->
                                <pagination:totalRows>${totalRow}</pagination:totalRows> <!-- 전체글수 -->
                                <pagination:pageSize>${pageSize}</pagination:pageSize> <!-- 페이지당 조회건수 -->
                            </pagination:paging>
                        </div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
</body>
</html>
